#!/usr/bin/env bash
if [ -n "$1" ]
then
    DAY="$1"
else
    DAY=0
fi
DATE=`date --date="$DAY day" +%Y-%m-%d`
file="risk_$DATE.sql"

if [ -f "$file" ]
then
	echo "$file found."
else
	echo "download $file."
    sftp -i /c/Users/qianq/Documents/rsa_private root@150.109.38.70:$file
fi
mysql --user=root --password=huhan3 --local-infile risk < $file
echo "done"
read stop